//
//  HHHPublicClass.h
//  project
//
//  Created by 黄建华 on 2017/9/27.
//  Copyright © 2017年 黄建华. All rights reserved.
//
/***************************************************枚举类型***********************************************/

typedef enum {
    SelectDateDay   = 0,
    SelectDateWeek  = 1,
    SelectDateMonth = 2,
    SelectDateYear  = 3
} SelectDateType;

typedef enum {
    CheckHeart = 1,
    CheckOX    = 2,
    CheckBP    = 3
} CheckType;

typedef enum {
    UpdateUiTypeRealStep = 0,
    UpdateUiTypeStep     = 1,
    UpdateUiTypeSleep    = 2,
    UpdateUiTypeHeart    = 3,
    UpdateUiTypeOx       = 4,
    UpdateUiTypeBp       = 5,
    UpdateUiTypeDevice   = 6
} UpdateUiType;

#define KK_BLEUPDATEFIRMWARE @"KK_BLEUPDATEFIRMWARE"
#define SN_PublicClass ([SNPublicClass sharedInstance])
#define SN_USER        ([SNPublicClass sharedInstance].userModel)
#define SN_Player      ([SNPublicClass sharedInstance].player)
#define KK_WeatherModel ([SNPublicClass sharedInstance].weatherModel)
#import <Foundation/Foundation.h>
#import "SportModel.h"
#import "SleepModel.h"
#import "HeartModel.h"
#import "OxModel.h"
#import "BpModel.h"
#import "TrackModel.h"
#import "SNUserInfoModel.h"
#import <AVFoundation/AVFoundation.h>
#import "WeatherModel.h"

@protocol BLTControlTypeDelegate <NSObject>
@optional
- (void)bleControlFindPhone;
- (void)bltControlTakePhoto;
@end

@interface SNPublicClass : NSObject
AS_SINGLETON(SNPublicClass)
/********************************************Swift*************************************/
typedef void(^SNCheckTypeBlock) (NSInteger type);
typedef void(^SNCheckHeartBlock) (NSInteger value);
typedef void(^SNCheckOxBlock) (NSInteger value);
typedef void(^SNCheckBpBlock) (NSInteger sbpValue,NSInteger dbpValue);
@property (nonatomic, strong) SNCheckTypeBlock checkBlock;
@property (nonatomic, strong) SNCheckHeartBlock heartBlock;
@property (nonatomic, strong) SNCheckOxBlock oxBlock;
@property (nonatomic, strong) SNCheckBpBlock bpBlock;
/********************************************手机设备类型*************************************/
@property (nonatomic, assign) NSInteger                   checkType;
@property (nonatomic, assign) BOOL                        isCheck;
@property (nonatomic, assign) NSInteger                   count;
@property (nonatomic, strong) id <BLTControlTypeDelegate> BLTControlTDelegate;
/***************************************************其他***********************************************/
// 获取选择月份的天数
- (NSInteger)getSelectMonthDays:(NSDate *)date;
//返回开始日期 和 结束日期  获取某日期所在的周月年 开始的日期 // 周月年 1 周 2 月 3年
- (NSArray *)getBeginDateStringAndEndWith:(NSDate *)newDate withType:(NSInteger)type;
// 获取某日期所在的周月年 开始的日期 // 周月年 1 周 2 月 3年
- (NSDate *)getMonthBeginAndEndWith:(NSDate *)newDate withType:(NSInteger)type;
// 选择日期是选择日期年的第几周
- (NSInteger)getDaysWeekNumberWithSelectDate:(NSDate *)date;
// 选择日期是选择日期年的第几月
- (NSInteger)getDaysMonthNumberWithSelectDate:(NSDate *)date;
// 选择日期是选择日期年的年份
- (NSInteger)getDaysYearNumberWithSelectDate:(NSDate *)date;
// 加圆角
- (UIView *)ViewForCorner:(UIView *)view;
// 加渐变图层
// 设置多段字体 参数1 字号  参数2 改变文字2 参数3 改变文字2
- (NSMutableAttributedString *)label1With:(NSString *)text withFontsize:(CGFloat)fontsize withChangeText1:(NSString *)text1 withChangeText2:(NSString *)text2;
/************************************UI界面元素***********************************/
@property (nonatomic, strong) NSDate         *selectDate;      // APP启动默认今天日期/日历选择日期
@property (nonatomic, strong) NSMutableArray *function;

- (NSInteger)heartQuality:(NSInteger)heartValue;
- (NSInteger)bpMaxQuality:(NSInteger)bpMaxValue;
- (NSInteger)bpMinQuality:(NSInteger)bpMinValue;
//临时数组
@property (nonatomic, strong) NSMutableArray *stepArray;       // 步数
@property (nonatomic, assign) NSInteger      sportTotal;       // 总步数临时
@property (nonatomic, strong) NSMutableArray *sleepArray;      // 模拟睡眠存放数组
@property (nonatomic, strong) NSMutableArray *todaySleepArray; // 今天睡眠
@property (nonatomic, strong) NSMutableArray *yesSleepArray;   // 昨天睡眠
@property (nonatomic, strong) NSMutableArray *sleepDetailArr;  // 睡眠详情

@property (nonatomic, strong) NSMutableArray *heartArray;      // 心率
@property (nonatomic, strong) NSMutableArray *todayHeartArray; // 今天心率数组
@property (nonatomic, strong) NSMutableArray *yesHeartArray;   // 昨天心率数组
@property (nonatomic, strong) NSMutableArray *heartCheckArray; // 手动检测心率临时数组
@property (nonatomic, strong) NSString       *heartValueString;
@property (nonatomic, strong) NSString       *oxValueString;
@property (nonatomic, strong) NSString       *bpValueString;
@property (nonatomic, strong) NSMutableArray *oXCheckArray;    // 手动检测血氧临时数组
@property (nonatomic, strong) NSMutableArray *bpCheckArray;    // 手动检测血压临时数组


@property (nonatomic, strong) NSMutableArray *oxArray;         // 血氧
@property (nonatomic, strong) NSMutableArray *bpMaxArray;      // 舒张压
@property (nonatomic, strong) NSMutableArray *bpMinArray;      // 伸缩压
@property (nonatomic, strong) NSMutableArray *trackArray;      // 跑道轨迹

@property (nonatomic, strong) SleepSubModel *sleepSubModel;    // 睡眠单次记录临时数组
@property (nonatomic, strong) TrackModel    *trackSubModel;    // 轨迹单次记录临时数组
@property (nonatomic, strong) heartSubModel *hearSubModel;     // 心率单次记录临时数组
@property (nonatomic, strong) oxSubModel    *oxSubModel;       // 血氧单次记录临时数组
@property (nonatomic, strong) bpSubModel    *bpSubModel;       // 血压单次记录临时数组

//周 月 年显示日期（根据当前选择的日期返回日期string)
- (NSString *)showDateWithType:(SelectDateType)type;

@property (nonatomic, strong) NSString      *lastDateString;   // 上一次日期
@property (nonatomic, strong) EveryDayModel *selectModel;      // 根据日历选中的天模型
@property (nonatomic, strong) EveryDayModel *todaymodel;       // 今天模型
@property (nonatomic, strong) EveryDayModel *yesModel;
- (EveryDayModel *)getEveryDayModelWithDate:(NSDate *)date;    // 每天模型
@property (nonatomic, strong) SNUserInfoModel *userModel;      // 用户模型
@property (nonatomic, strong) AVPlayer *player;                //视频播放器
@property (nonatomic, strong) WeatherModel *weatherModel;                //视屏播放器
// 1 实时数据  2 大数据
- (void)updateUser;
- (NSString *)getWithSql:(NSString *)sql;
- (void)writefileWith:(NSString *)string;    // 日志LOG
- (void)writefileWithNet:(NSString *)string; // 上传日志LOG

#pragma sportModel
// 今日与昨天的参数
@property (nonatomic, strong) SportModel *todaySport;
@property (nonatomic, strong) SportModel *yesSport;
@property (nonatomic, strong) SleepModel *todaySleep;
@property (nonatomic, strong) SleepModel *yesSleep;
@property (nonatomic, strong) HeartModel *todayHeart;
@property (nonatomic, strong) HeartModel *yesHeart;
@property (nonatomic, strong) OxModel    *todayOx;
@property (nonatomic, strong) OxModel    *yesOx;
@property (nonatomic, strong) BpModel    *todayBp;
@property (nonatomic, strong) BpModel    *yesBp;
@end

